﻿// Copyright 2009 Mike Geise
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Falcon.Core.Domain.Services
{
	using System.Collections.Generic;
	using Falcon.Core.Collections;
	using Falcon.Core.Domain.Values;

	public interface IResourceService
	{
		/// <summary>
		/// Gets the resource by the specified specification.
		/// </summary>
		/// <param name="specification">The <see cref="ResourceSpecification"/>.</param>
		Resource GetBy(ResourceSpecification specification);

		/// <summary>
		/// Gets the resource by the specified id.
		/// </summary>
		/// <param name="id">The id.</param>
		/// 
		Resource GetById(int id);

		/// <summary>
		/// Gets all the resources.
		/// </summary>
		IList<Resource> GetAll();

		/// <summary>
		/// Gets all the resources by the specified specification.
		/// </summary>
		/// <param name="specification">The <see cref="ResourceSpecification"/>.</param>
		IPagedList<Resource, ResourceSpecification> GetPaged(ResourceSpecification specification);

		/// <summary>
		/// Creates the resource.
		/// </summary>
		Resource Create();

		/// <summary>
		/// Initializes this instance.
		/// </summary>
		void Init();

		/// <summary>
		/// Rebuilds this instance.
		/// </summary>
		void Rebuild();

		/// <summary>
		/// Inserts the specified resource.
		/// </summary>
		/// <param name="resource">The <see cref="Resource"/>.</param>
		void Insert(Resource resource);

		/// <summary>
		/// Inserts the specified resource.
		/// </summary>
		/// <param name="resource">The resource.</param>
		/// <param name="value">The value.</param>
		void Insert(Resource resource, ResourceCreate value);

		/// <summary>
		/// Updates the specified resource.
		/// </summary>
		/// <param name="resource">The <see cref="Resource"/>.</param>
		void Update(Resource resource);

		/// <summary>
		/// Updates the specified resource.
		/// </summary>
		/// <param name="resource">The resource.</param>
		/// <param name="value">The value.</param>
		void Update(Resource resource, ResourceUpdate value);

		/// <summary>
		/// Deletes the specified resource.
		/// </summary>
		/// <param name="resource">The <see cref="Resource"/>.</param>
		void Delete(Resource resource);
	}
}